﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Site.Mobile
{
    public partial class AddHive : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string sHID = edtHID.Text;
            string sWID = edtWID.Text;
            string sLoc = edtLong.Text + " " + edtLat.Text;
            SqlDataSource1.InsertCommand = "INSERT INTO Hives (Hive_ID, WID, DateCreated, Location) VALUES (@Hive_ID, @WID, @DateCreated, @Location)";
            SqlDataSource1.InsertParameters.Add("Hive_ID", sHID);
            SqlDataSource1.InsertParameters.Add("WID", sWID);
            SqlDataSource1.InsertParameters.Add("DateCreated", DateTime.Now.ToShortDateString());
            SqlDataSource1.InsertParameters.Add("Location", sLoc);
            SqlDataSource1.Insert();
            Response.Redirect("Hives.aspx");
        }
    }
}